﻿using UnityEngine;
using System.Collections;

public class DragItem : MonoBehaviour {
	
	public Object CreateOnDrop;
	
	void OnPress(bool pressed)
	{
		print ("onPressed :" + pressed);
		collider.enabled = !pressed;
		
		if( !pressed)
		{
			Collider col = UICamera.lastHit.collider;
			if( col == null || col.GetComponent<DropSurface>() == null)
			{
				UIGrid grid = NGUITools.FindInParents<UIGrid>(gameObject);
				if( grid != null)
				{
					grid.Reposition();
				}
			}
		}
		
	}

}
